package com.we823.project.model.product;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.alibaba.fastjson.annotation.JSONField;
import com.we823.project.common.web.status.TaskStatus;
import com.we823.project.common.web.status.TaskType;
import com.we823.project.model.BaseModelWithDate;
import com.we823.project.model.StationModel;

/**
 * 计划详情
 * @author ZhangYinxian
 *
 */
@Entity
@Table(name="we_plan_detail")
public class PlanDetailModel extends BaseModelWithDate {
	private static final long serialVersionUID = 1L;

	@Column(name="plan_id")
	private int planId=0;
	
	@Transient
	private PlanModel plan;
	
	@Column(name="plan_code")
	private String planCode;

	@JSONField(format="yyyy-MM-dd")
	@Temporal(TemporalType.DATE)
	@Column(name="create_date")
	private Date createDate;

	@Column(name="material_code")
	private String materialCode;
	
	@Column(name="material_model")
	private String materialModel;
	
	@Column(name="material_desc")
	private String materialDesc;
	
	@Column(name="need_total")
	private float needTotal;
	@Transient
	private float finalNum;
	
	private String unit;
	
	@Column(name="station_id")
	private int stationId=0;
	
	@Transient
	private StationModel station;
	@Transient
	private String stationName;
	@Transient
	private String realname;
	@Transient
	private String taskCode;
	@Transient
	private Integer taskId;
	
	/**
	 * 总共用时
	 */
	@Transient
	private String countTime;
	
	@JSONField(format="yyyy-MM-dd")
	@Temporal(TemporalType.DATE)
	@Column(name="finish_date")
	private Date finishDate;

	private String memo;
	
	@Enumerated(EnumType.STRING)
	private TaskStatus status= TaskStatus.NoAssign;
	
	@Transient
	private String statusMessage;
	
	@Enumerated(EnumType.STRING)
	private TaskType type = TaskType.normal;
	
	private Integer deep=0;
	
	private Integer orderid=1;
	
	private String process;
	@Column(name="pre_process")
	private String preProcess;
	@Column(name="next_process")
	private String nextProcess;
	@Column(name="dest_code")
	private String destCode;
	@Column(name="dest_model")
	private String destModel;

	/**
	 * 指示是否有前导工序未完成
	 */
	@Transient
	private boolean hasPreProcess=false;
	/**
	 * 记录前导工序信息
	 */
	@Transient
	private String processMessage;
	
	public PlanDetailModel() {
	}

	public int getPlanId() {
		return planId;
	}

	public void setPlanId(int planId) {
		this.planId = planId;
	}

	public PlanModel getPlan() {
		return plan;
	}

	public void setPlan(PlanModel plan) {
		this.plan = plan;
	}

	public String getPlanCode() {
		return planCode;
	}

	public void setPlanCode(String planCode) {
		this.planCode = planCode;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getMaterialCode() {
		return materialCode;
	}

	public void setMaterialCode(String materialCode) {
		this.materialCode = materialCode;
	}

	public String getMaterialModel() {
		return materialModel;
	}

	public void setMaterialModel(String materialModel) {
		this.materialModel = materialModel;
	}

	public String getMaterialDesc() {
		return materialDesc;
	}

	public void setMaterialDesc(String materialDesc) {
		this.materialDesc = materialDesc;
	}

	public float getNeedTotal() {
		return needTotal;
	}

	public void setNeedTotal(float needTotal) {
		this.needTotal = needTotal;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public int getStationId() {
		return stationId;
	}

	public void setStationId(int stationId) {
		this.stationId = stationId;
	}

	public StationModel getStation() {
		return station;
	}

	public void setStation(StationModel station) {
		this.station = station;
	}

	public String getStationName() {
		return stationName;
	}

	public void setStationName(String stationName) {
		this.stationName = stationName;
	}

	public Date getFinishDate() {
		return finishDate;
	}

	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public TaskStatus getStatus() {
		return status;
	}

	public void setStatus(TaskStatus status) {
		this.status = status;
	}

	public String getStatusMessage() {
		if (status!=null) {
			return statusMessage = status.getDisplay();
		}
		return statusMessage;
	}

	public void setStatusMessage(String statusMessage) {
		this.statusMessage = statusMessage;
	}

	public TaskType getType() {
		return type;
	}

	public void setType(TaskType type) {
		this.type = type;
	}

	public Integer getDeep() {
		return deep;
	}

	public void setDeep(Integer deep) {
		this.deep = deep;
	}

	public Integer getOrderid() {
		return orderid;
	}

	public void setOrderid(Integer orderid) {
		this.orderid = orderid;
	}

	public String getProcess() {
		return process;
	}

	public void setProcess(String process) {
		this.process = process;
	}

	public String getPreProcess() {
		return preProcess;
	}

	public void setPreProcess(String preProcess) {
		this.preProcess = preProcess;
	}

	public String getNextProcess() {
		return nextProcess;
	}

	public void setNextProcess(String nextProcess) {
		this.nextProcess = nextProcess;
	}

	public String getDestCode() {
		return destCode;
	}

	public void setDestCode(String destCode) {
		this.destCode = destCode;
	}

	public String getDestModel() {
		return destModel;
	}

	public void setDestModel(String destModel) {
		this.destModel = destModel;
	}

	public boolean getHasPreProcess() {
		return hasPreProcess;
	}

	public void setHasPreProcess(boolean hasPreProcess) {
		this.hasPreProcess = hasPreProcess;
	}

	public String getProcessMessage() {
		return processMessage;
	}

	public void setProcessMessage(String processMessage) {
		this.processMessage = processMessage;
	}

	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	public String getTaskCode() {
		return taskCode;
	}

	public void setTaskCode(String taskCode) {
		this.taskCode = taskCode;
	}

	public float getFinalNum() {
		return finalNum;
	}

	public void setFinalNum(float finalNum) {
		this.finalNum = finalNum;
	}

	public Integer getTaskId() {
		return taskId;
	}

	public void setTaskId(Integer taskId) {
		this.taskId = taskId;
	}

	public String getCountTime() {
		return countTime;
	}

	public void setCountTime(String countTime) {
		this.countTime = countTime;
	}

}